package com.bwie.controller;

import com.bwie.pojo.TbParkingLot;
import com.bwie.service.TbParkingLotService;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/parking/index")
public class IndexController {
    @Resource
    TbParkingLotService tbParkingLotService;

    /**
     * 分页获取停车厂列表
     * @param pageInfoVo
     * @return
     */
    @PostMapping("/getParkingLotList")
    public R getParkingLotList(@RequestBody PageInfoVo pageInfoVo){
        return tbParkingLotService.getParkingLotList(pageInfoVo);
    }

    /**
     * 车辆进场
     * @param tbParkingLot
     * @return
     */
    @PostMapping("/addCar")
    public R addCar(@RequestBody TbParkingLot tbParkingLot){
        return tbParkingLotService.addCar(tbParkingLot);
    }

    /**
     * 自助结算
     * @param tbParkingLot
     * @return
     */
    @PostMapping("/updateCarStatus")
    public R updateCarStatus(@RequestBody TbParkingLot tbParkingLot){
        return tbParkingLotService.updateCarStatus(tbParkingLot);
    }

    /**
     * 车辆离场
     * @param tbParkingLot
     * @return
     */
    @PostMapping("/deleteCar")
    public R deleteCar(@RequestBody TbParkingLot tbParkingLot){
        return tbParkingLotService.deleteCar(tbParkingLot);
    }
}
